package com.example.library_room.db

import androidx.room.*
import com.example.library_room.converter.DateConverter
import io.reactivex.annotations.NonNull
import java.util.*

@Entity(tableName = "user_db", indices = [Index("user_id")])
class UserDB {
    //消息发送的时间戳，保存消息的主键
    @PrimaryKey(autoGenerate = true)
    @NonNull
    @ColumnInfo(name = "user_id")
    var userId: Long? = null

    @ColumnInfo(name = "user_name")
    var userName: String? = null

    @ColumnInfo(name = "user_age")
    var userAge: Int? = null

    @ColumnInfo(name = "user_birthday")
    @TypeConverters(DateConverter::class)
    var userBirthday: Date? = null

    @ColumnInfo(name = "user_photo")
    var userPhoto: String? = null

    @ColumnInfo(name = "user_mobile")
    var userMobile: String? = null

    @ColumnInfo(name = "user_status")
    var userStatus: Boolean = true

    @ColumnInfo(name = "user_motto")
    var userMotto: String? = null

    @ColumnInfo(name = "create_time")
    @TypeConverters(DateConverter::class)
    var createTime: Date? = null

    @ColumnInfo(name = "update_time")
    @TypeConverters(DateConverter::class)
    var updateTime: Date? = null
}